package com.bayihouse.model.excel.publicClass;

import com.baomidou.mybatisplus.annotation.TableField;
import com.bayihouse.model.excel.publicClass.father.BaseEntity;
import com.bayihouse.utils.MyObjectUtils;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.ArrayList;
import java.util.List;


@Data
@AllArgsConstructor
@NoArgsConstructor
public abstract class BaseTwoEntity <T,V> extends BaseEntity {

    @TableField(exist = false)
    protected List<T> tlist;

    @TableField(exist = false)
    protected List<V> vlist;

    public void InitT(){
        tlist = new ArrayList<>();
    }

    public void InitV() {
        vlist = new ArrayList<>();
    }


    protected abstract void setTId();


    protected abstract void setVId();


    protected boolean checkIsEmptyTList() {
        if (super.id == null) {
            return true;
        }
        if (MyObjectUtils.isArraysEmpty(tlist)) {
            return true;
        }
        return false;
    }


    protected boolean checkIsEmptyVList() {
        if (super.id == null) {
            return true;
        }
        if (MyObjectUtils.isArraysEmpty(vlist)) {
            return true;
        }
        return false;
    }
}
